import { detailCampaignPopup } from '~comp-b/referral/campaign/CampaignDetails.vue';
import { addCampaignPopup } from '~comp-b/referral/campaign/CampaignEdit.add.vue';
import { modCampaignPopup } from '~comp-b/referral/campaign/CampaignEdit.mod.vue';
import { orderSharePopup, referralSharePopup } from '~comp-b/share';

import { useAutoPopupController } from '~/composables/usePeriodicPopup';
import { welcomeBonusPopup } from '~/pages/promo/pack/components/WelcomeBonusPoup.vue';
import {
  createAccountFromTgPopup,
  disable2FAPopup,
  enable2FAPopup,
  resetPasswordPopup,
  setPasswordPopup,
  signPopup,
  updatePasswordPopup,
  verify2FAPopup,
  verifyEmailPopup,
} from '../auth';
import { claimPopup } from '../bonuses/Claim.vue';
import { claimSuccessPopup } from '../bonuses/ClaimSuccess.vue';
import { bonuses } from '../bonuses/index.vue';
import { langPopup } from '../lang/LangPopup.vue';
import { rankPopup } from '../rank/RankSwipe.vue';
import { invitedBrokerageShare } from '../share/InvitedBrokerageShare.vue';
import { invitedShare } from '../share/InvitedShare.vue';
import { lotteryShare } from '../share/LotteryShare.vue';
import { attendance } from './attendance/Attendance.vue';
import { coinNetworkPopup } from './coin-network/CoinNetwork.vue';
import { gameRecordDetailPopup } from './game-record-detail/index.vue';
import { searchPopup } from './game-search/GameSearch.vue';
import { invitationSpin, invitationSpinPayouts } from './invitation/index';
import { loadingPopup } from './loading/Loading.vue';
import { lottery } from './lottery/Lottery.vue';
import { signUpBonusPopup } from './newWallet/Comps/SignUpBonusPoup.vue';
import { wallet } from './newWallet/index.vue';
import { bonusPopup } from './rewards/BonusPopup.vue';
import { bonusRecordPopup } from './rewards/BonusRecord.vue';
import { inviteBonusPopup } from './rewards/InviteBonusPopup.vue';
import { referInfoPopup } from './rewards/ReferPopup.vue';
import { rewardInfoPopup } from './rewards/RewardPopup.vue';
import { signUpForGiftingTipsPopup } from './sign-up-for-gifting-tips/SignUpForGiftingTips.vue';
import { userProfilePopup } from './user-info/index.vue';
import { userModifyPopup } from './userModify/index.vue';

const { deletePopup } = useAutoPopupController();
const { luckySpinFirstTipsState } = useFirstRechargeTips();

const newUserAward = useAntdModal(
  defineAsyncComponent(() => import('./new-user-award/NewUserAward.vue')),
  { title: computed(() => $t('iMmofWh1Lujp8x476a2n1')), maskClosable: false, width: 460, wrapClassName: 'ant-cover__Modal-drawer  ', centered: true, footer: null, closable: true, onCancel: () => {
    luckySpinFirstTipsState.unRecharge = true;
    deletePopup('newUserAward');
    // globalPopups.attendance?.open();
  } },
);

export const globalPopups = {
  loading: loadingPopup,
  wallet,
  userProfile: userProfilePopup,
  userModify: userModifyPopup,
  sign: signPopup,
  setPassword: setPasswordPopup,
  updatePassword: updatePasswordPopup,
  verifyEmail: verifyEmailPopup,
  enable2FA: enable2FAPopup,
  disable2FA: disable2FAPopup,
  verify2FA: verify2FAPopup,
  resetPassword: resetPasswordPopup,
  orderShare: orderSharePopup,
  lotteryShare, // 彈窗分享
  referralShare: referralSharePopup,
  referInfo: referInfoPopup,
  rewardInfo: rewardInfoPopup,
  bonusInfo: bonusPopup,
  bonusRecord: bonusRecordPopup,
  inviteBonus: inviteBonusPopup,
  addCampaign: addCampaignPopup,
  modCampaign: modCampaignPopup,
  dtlcampaign: detailCampaignPopup,
  claimSuccess: claimSuccessPopup, // 領取成功
  claim: claimPopup,
  gameRecordDetail: gameRecordDetailPopup,
  createAccountFromTg: createAccountFromTgPopup,
  rankPopup,
  lottery,
  bonuses,
  searchPopup,
  coinNetworkPopup,
  langPopup,
  welcomeBonusPopup,
  signUpBonusPopup,
  newUserAward,
  attendance,
  signUpForGiftingTipsPopup,
  invitationSpin,
  invitationSpinPayouts,
  invitedShare,
  invitedBrokerageShare,
};

setTimeout(async () => {
  // globalPopups.newUserAward.open();
}, 2000);

if (import.meta.env.DEV) {
  (window as any).globalPopups = globalPopups;
}
